-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(nsis): allow disabling of building a universal installer #8607
base: master
Are you sure you want to change the base?
Conversation
…able-win-universal
🦋 Changeset detectedLatest commit: ae6545b The changes in this PR will be included in the next version bump. This PR includes changesets to release 8 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
✅ Deploy Preview for car-park-attendant-cleat-11576 ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
protected buildUniversalInstaller() { | ||
const buildSeparateInstallers = this.options.buildUniversalInstaller === false | ||
return !buildSeparateInstallers | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
protected buildUniversalInstaller() {
return this.options.buildUniversalInstaller
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
buildUniversalInstaller
is optional, so we must check against explicit false.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not a get function, so there shouldn't be any caching, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to cache the result? It's just reading from options.
But I agree, it could simply be a get function. I'll update the PR
protected installerFilenamePattern(primaryArch?: Arch | null, defaultArch?: string): string { | ||
if (!this.buildUniversalInstaller()) { | ||
return "${productName} " + (this.isPortable ? "" : "Setup ") + "${version}" + (primaryArch != null ? getArchSuffix(primaryArch, defaultArch) : "") + ".${ext}" | ||
} | ||
// tslint:disable:no-invalid-template-strings | ||
return "${productName} " + (this.isPortable ? "" : "Setup ") + "${version}.${ext}" | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
protected installerFilenamePattern(primaryArch?: Arch | null, defaultArch?: string): string {
const setupText = this.isPortable ? "" : "Setup ";
const archSuffix = !this.buildUniversalInstaller() && primaryArch != null
? getArchSuffix(primaryArch, defaultArch)
: "";
return "${productName} " + setupText + "${version}" + archSuffix + ".${ext}";
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Love it, I'll update the logic.
By default, electron-builder builds a universal NSIS package when multiple archs are specified. This universal exe size is usually the sum of each individual installer.
This PR introduces a config property
buildUniversalInstaller
(defaulttrue
for backward compatibility)In order to build separate exe's, I needed to update the installer name template to include an arch. Unless a
defaultArch
is supplied, x64 will not have a suffix appended to the file name and the other arch builds will have suffix-${arch}
.electron-builder/packages/app-builder-lib/src/targets/nsis/NsisTarget.ts
Lines 140 to 146 in 1b41b17
Note: Only
nsis
targets supports individual installers asnsis-web
requires 32 bit arch to be present in the distributable package since it automatically detects OS architecture and downloads the corresponding package file.nsis-web
logic overrides any setting tobuildUniversalInstaller
totrue
.Ref: https://www.electron.build/nsis.html#web-installer
Resolves: #8298 and #8597